package components.ball;

import com.uqbar.vainilla.DeltaState;
import components.CollisionableComponent;

public class PlayingBallState extends BallState {

	public PlayingBallState(NormalBall aBall) {
		super(aBall);
	}

	@Override
	public void update(DeltaState deltaState) {

		this.moveBall(deltaState);
	}
	
	private void moveBall(DeltaState delta) {
		double intensity = delta.getDelta() * this.getBall().getSpeed();
		double nx, ny;
		nx = this.getBall().getX() +intensity * this.getBall().getDirVectorX();
		ny = this.getBall().getY() +intensity * this.getBall().getDirVectorY();
		
		this.getBall().collide(nx, ny);
		
		
		this.getBall().updateCoords(intensity * this.getBall().getDirVectorX(), intensity * this.getBall().getDirVectorY());
	}
	




}
